home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / Mesa / src-glut / glutstuff.h < prev    next >
C/C++ Source or Header  |  1998-08-02  |  4KB  |  168 lines

  1. /*
  2.  * Amiga GLUT graphics library toolkit
  3.  * Version:  1.1
  4.  * Copyright (C) 1998 Jarno van der Linden
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Library General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Library General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Library General Public
  17.  * License along with this library; if not, write to the Free
  18.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21.  
  22. /*
  23.  * glutstuff.h
  24.  *
  25.  * Version 1.0  27 Jun 1998
  26.  * by Jarno van der Linden
  27.  * jarno@kcbbs.gen.nz
  28.  *
  29.  * Version 1.1  02 Aug 1998
  30.  * by Jarno van der Linden
  31.  * jarno@kcbbs.gen.nz
  32.  *
  33.  * - Quantizer plugin support added
  34.  *
  35.  */
  36.  
  37.  
  38. #include <exec/types.h>
  39.  
  40. #include "gl/glut.h"
  41. #include "gl/amigamesartl.h"
  42.  
  43.  
  44. #define WIN_WIDTH(win)        ((win)->Width - (win)->BorderLeft - (win)->BorderRight)
  45. #define WIN_HEIGHT(win)        ((win)->Height - (win)->BorderTop - (win)->BorderBottom)
  46.  
  47.  
  48. struct GlutMenuEntry
  49. {
  50.     struct GlutMenuEntry *next, *prev;
  51.  
  52.     char *name;
  53.     int value;
  54.     BOOL issubmenu;
  55.  
  56.     struct GlutMenu *menu;
  57. };
  58.  
  59.  
  60. struct GlutMenu
  61. {
  62.     int menuid;
  63.     struct GlutMenu *next, *prev;
  64.  
  65.     void (*menufunc)(int value);
  66.  
  67.     struct GlutMenuEntry *entries;
  68.     int numentries;
  69.  
  70.     BOOL needupdate;
  71. };
  72.  
  73.  
  74. struct GlutWindow
  75. {
  76.     struct Window *window;
  77.     int winid;
  78.     struct GlutWindow *next, *prev;
  79.  
  80.     AmigaMesaRTLContext context;
  81.  
  82.     APTR vi;
  83.  
  84.     struct Menu *menu;
  85.     struct GlutMenu *leftmenu, *middlemenu, *rightmenu;
  86.  
  87.     UWORD qualifiers;
  88.     int mousex, mousey;
  89.  
  90.     int winx, winy;                /* Shape that we want */
  91.     int winwidth, winheight;
  92.     int wincurx, wincury;        /* Shape that we believe it to currently be */
  93.     int wincurwidth, wincurheight;
  94.  
  95.     void (*displayfunc)(void);
  96.     void (*keyboardfunc)(unsigned char key,int x, int y);
  97.     void (*reshapefunc)(int width, int height);
  98.     void (*visibilityfunc)(int state);
  99.     void (*specialfunc)(int key, int x, int y);
  100.     void (*mousefunc)(int button, int state, int x, int y);
  101.     void (*motionfunc)(int x, int y);
  102.     void (*passivemotionfunc)(int x, int y);
  103.  
  104.     BOOL needredisplay;
  105.     BOOL needreshape, needreshapegui;
  106.     BOOL needposition, needpositiongui;
  107.     BOOL needvisibility, visible;
  108.     BOOL needleftmenu, needmiddlemenu, needrightmenu;
  109. };
  110.  
  111.  
  112. struct GlutStuff
  113. {
  114.     struct MsgPort *msgport;
  115.     struct GlutWindow *curwin;
  116.     struct GlutWindow *wins;
  117.     int nextwinid;
  118.  
  119.     struct GlutMenu *curmenu;
  120.     struct GlutMenu *menus;
  121.     int nextmenuid;
  122.  
  123.     int initposx, initposy;
  124.     int initwidth, initheight;
  125.  
  126.     int numcolours;
  127.     int colourbase;
  128.     char *pubscreenname;
  129.     char *quantizer;
  130.     ULONG quantizerversion;
  131.  
  132.     GLboolean rgba;
  133.     GLboolean alpha;
  134.     GLboolean db;
  135.     GLboolean accum;
  136.     GLboolean depth;
  137.     GLboolean stencil;
  138.     GLboolean multisample;
  139.     GLboolean stereo;
  140.     GLboolean luminance;
  141.  
  142.     void (*idlefunc)(void);
  143.     void (*menustatusfunc)(int status, int x, int y);
  144.  
  145.     ULONG basetime_secs, basetime_micros;
  146.     BOOL havebasetime;
  147. };
  148.  
  149.  
  150. extern struct GlutStuff glutstuff;
  151.  
  152.  
  153. int stuffGetNewWinID(void);
  154. struct GlutWindow *stuffGetWin(int winid);
  155. void stuffLinkInWin(struct GlutWindow *gw);
  156. void stuffLinkOutWin(struct GlutWindow *gw);
  157. void stuffMakeCurrent(struct GlutWindow *gw);
  158.  
  159. int stuffGetNewMenuID(void);
  160. struct GlutMenu *stuffGetMenu(int menuid);
  161. void stuffLinkInMenu(struct GlutMenu *gm);
  162. void stuffLinkOutMenu(struct GlutMenu *gm);
  163. void stuffMakeCurrentMenu(struct GlutMenu *gm);
  164.  
  165. struct GlutMenuEntry *stuffGetMenuEntry(int entry,struct GlutMenu *gm);
  166. void stuffLinkInMenuEntry(struct GlutMenuEntry *gme,struct GlutMenu *gm);
  167. void stuffLinkOutMenuEntry(struct GlutMenuEntry *gme,struct GlutMenu *gm);
  168.